<!-- 订单分佣表表单弹窗 -->
<form id="ordercommision-form" lay-filter="ordercommision-form" class="layui-form model-form" style="overflow:auto; height:500px;width:90%;">
    <input name="id" type="hidden"/>
    				    <div class="layui-form-item">
        <label class="layui-form-label">关联订单</label>
        <div class="layui-input-block">
            <input name="orderId" placeholder="请输入订单ID" type="text" class="layui-input" maxlength="20"  id="orderId"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">分佣归属</label>
        <div class="layui-input-block">
            <input name="payeeType" placeholder="请输入0-平台，1-商家，2-老师，3-会员" type="text" class="layui-input layui-hide" maxlength="20"  id="payeeType"
                   lay-verify="required" required/>
            <input name="strPayeeType"  type="text" class="layui-input" maxlength="20"  id="strPayeeType"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">收款方</label>
        <div class="layui-input-block">
            <input name="payeeId" placeholder="请输入收款人ID,0-平台，business_id-商家，member_id-会员或老师" type="text" class="layui-input layui-hide" maxlength="20"  id="payeeId"
                   lay-verify="required" required/>
            <input name="commisionPartName"  type="text" class="layui-input" maxlength="20"  id="commisionPartName"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">佣金金额</label>
        <div class="layui-input-block">
            <input name="price" placeholder="请输入佣金金额" type="text" class="layui-input" maxlength="20"  id="price"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">操作类型</label>
        <div class="layui-input-block">
            <input name="action" placeholder="请输入操作类型，0-减少，1-增加" type="text" class="layui-input layui-hide" maxlength="20"  id="action"
                   lay-verify="required" required/>
            <input name="strAction"  type="text" class="layui-input" maxlength="20"  id="strAction"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-block">
            <!--<input name="createDate" placeholder="请输入创建时间" type="text" class="layui-input" maxlength="20"  id="createDate"-->
                   <!--lay-verify="required" required/>-->
            <label class="layui-form-label" style="width: 180px;text-align: left;" name="createDate"  id="createDate"></label>
        </div>
    </div>
     <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <!--<button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>-->
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        var formSelects = layui.formSelects;

        var ordercommision = admin.getTempData('t_ordercommision');
           if (ordercommision.method=="update"){
               console.log(ordercommision);
               if(ordercommision.payeeType==0){
                   ordercommision.strPayeeType="平台";
               }else if(ordercommision.payeeType==1){
                   ordercommision.strPayeeType="商家";
               }else if(ordercommision.payeeType==2){
                   ordercommision.strPayeeType="专家";
               }else if(ordercommision.payeeType==3){
                   ordercommision.strPayeeType="会员";
               }
               if(ordercommision.action==0){
                   ordercommision.strAction="减少";
               }else if(ordercommision.action==1){
                   ordercommision.strAction="增加";
               }
               $("#createDate").text(ordercommision.createDate);
        	form.val('ordercommision-form', ordercommision);
            form.render();
        }
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
             layer.load(2);

            admin.req('order/ordercommision/'+ordercommision.method, JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, "post");
            return false;
        });
    });
</script>
